package payment.mobilepos.unionpay.com.metroguide.ui;

import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.content.ContextCompat;
import android.support.v7.app.AppCompatActivity;
import android.view.KeyEvent;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import payment.mobilepos.unionpay.com.metroguide.R;
import payment.mobilepos.unionpay.com.metroguide.utils.StatusBarCompat;

/**
 * <pre>
 *     author : liuso
 *     e-mail : xxx@xx
 *     time   : 2018/12/25
 *     desc   :
 *     version: 1.0
 * </pre>
 */
public class QueryResultActivity extends AppCompatActivity {

    private TextView mTextTv;
    private String mJoin = "";
    private TextView mpriceTv;
    private ImageView backIv;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        StatusBarCompat.setStatusBarColor(this, ContextCompat.getColor(this, R.color.colorPrimary));
        setContentView(R.layout.query_result);
        mTextTv = findViewById(R.id.path_tv);
        mpriceTv = findViewById(R.id.price_tv);
        backIv = findViewById(R.id.back_iv);
        Intent intent = getIntent();
        String paths = intent.getStringExtra("path");
        String price = intent.getStringExtra("price");
        if (paths==null)return;
        mTextTv.setText(paths);
        mpriceTv.setText(getString(R.string.query_staion_price, paths.split("-").length, price));
        backIv.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                QueryResultActivity.this.finish();
            }
        });
    }

    @Override
    public boolean onKeyDown(int keyCode, KeyEvent event) {
        if (keyCode == KeyEvent.KEYCODE_BACK) { // 监控/拦截/屏蔽返回键
            finish();
        } else if (keyCode == KeyEvent.KEYCODE_MENU) {
            return true;
        } else if (keyCode == KeyEvent.KEYCODE_HOME) {
        }
        return super.onKeyDown(keyCode, event);
    }
}
